home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / simple6a / form2.frm < prev    next >
Text File  |  1999-09-22  |  3KB  |  117 lines

  1. VERSION 5.00
  2. Begin VB.Form Form2 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Carregar Imagem"
  5.    ClientHeight    =   4290
  6.    ClientLeft      =   45
  7.    ClientTop       =   345
  8.    ClientWidth     =   6105
  9.    Icon            =   "Form2.frx":0000
  10.    LinkTopic       =   "Form2"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   4290
  14.    ScaleWidth      =   6105
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.CommandButton Command2 
  18.       Caption         =   "&OK"
  19.       Height          =   495
  20.       Left            =   2040
  21.       TabIndex        =   4
  22.       Top             =   3720
  23.       Width           =   1935
  24.    End
  25.    Begin VB.DriveListBox Drive1 
  26.       Height          =   315
  27.       Left            =   120
  28.       TabIndex        =   3
  29.       Top             =   3240
  30.       Width           =   2895
  31.    End
  32.    Begin VB.DirListBox Dir1 
  33.       Height          =   3015
  34.       Left            =   120
  35.       TabIndex        =   2
  36.       Top             =   120
  37.       Width           =   2895
  38.    End
  39.    Begin VB.FileListBox File1 
  40.       Height          =   3405
  41.       Hidden          =   -1  'True
  42.       Left            =   3120
  43.       Pattern         =   "*.bmp;*.gif;*.jpg;*.wmf"
  44.       System          =   -1  'True
  45.       TabIndex        =   1
  46.       Top             =   120
  47.       Width           =   2895
  48.    End
  49.    Begin VB.CommandButton Command1 
  50.       Caption         =   "&Cancelar"
  51.       Height          =   495
  52.       Left            =   4080
  53.       TabIndex        =   0
  54.       Top             =   3720
  55.       Width           =   1935
  56.    End
  57.    Begin VB.Image Image1 
  58.       Height          =   9000
  59.       Left            =   5040
  60.       Picture         =   "Form2.frx":0442
  61.       Top             =   0
  62.       Visible         =   0   'False
  63.       Width           =   12000
  64.    End
  65. End
  66. Attribute VB_Name = "Form2"
  67. Attribute VB_GlobalNameSpace = False
  68. Attribute VB_Creatable = False
  69. Attribute VB_PredeclaredId = True
  70. Attribute VB_Exposed = False
  71. Option Compare Text
  72.  
  73. Private Sub Command1_Click()
  74. 'Cancel was pressed. Unload the Image Loader Form
  75.     Unload Me
  76. End Sub
  77.  
  78. Private Sub Command2_Click()
  79. 'Ok was pressed. Set the puzzle new image
  80.     Dim S As String
  81. 'Get the file's path and check if it already has a "\"
  82. 'If not then add one "\"
  83.     S = File1.Path
  84.     If Not S Like "*\" Then S = S & "\"
  85. 'Now add the file name
  86.     S = S & File1.FileName
  87. 'Unload the Image Loader Form
  88.     Unload Me
  89. 'Load the puzzle new image
  90.     Image1.Picture = LoadPicture(S)
  91. 'Hide the pieces and start again
  92.     HideAll
  93.     Start
  94. End Sub
  95.  
  96. Private Sub Dir1_Change()
  97. 'Set the FileListBox Path equal to the DirListBox
  98.     File1.Path = Dir1.Path
  99. End Sub
  100.  
  101. Private Sub Drive1_Change()
  102.     On Error Resume Next
  103. RR:
  104. 'Set the DirListBox Path equal to the DriveListBox
  105. 'selected drive
  106.     Dir1.Path = UCase(Drive1.Drive)
  107. 'Error 68 ocurrs when there is an error with access to
  108. 'the Drive
  109.     If Err.Number = 68 Then
  110.         Err.Clear
  111. 'Check if the user want's to retry
  112.         If MsgBox("The drive " & Drive1.Drive & " is not ready! Try again?", vbApplicationModal + vbExclamation + vbYesNo, "Error") = vbYes Then GoTo RR
  113. 'Else set the Drive to the default C: drive
  114.         Drive1.Drive = "C:\"
  115.     End If
  116. End Sub
  117.